home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / patch / WHD_TowerBabel.lha / WHD_TowerBabel / InstallSD < prev    next >
Text File  |  2001-04-28  |  5KB  |  214 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Tower of Babel Save Disk")
  5. (set #CFG_APPVER  "R0401.1")
  6. (set #CFG_APPCOPY "1997-2001")
  7.  
  8. ;================================================================================
  9.  
  10. ;------------------------------------------------------------------------------------
  11. ; Checks if given program is reachable via the path, if not abort install
  12. ;
  13. ; Entry:    #VP1 = name of program to search for
  14.  
  15. (procedure P_CheckRun (
  16.     (if (<> 0 (run (cat "Which " #VP1)))(
  17.         (abort
  18.             (cat
  19.                 "Could not find the program\n\n"
  20.                 "'" #VP1 "'\n\n"
  21.                 "which is required to perform the installation!\n\n"
  22.                 "Please install the '" #VP1 "' program ensuring that"
  23.                 " it is accessible on the path, then try the installation again."
  24.             )
  25.         )
  26.     ))
  27. ))
  28.  
  29. ;------------------------------------------------------------------------------------
  30. (procedure P_InstallGame (
  31.  
  32.     (set #VSAVEDONE 0)
  33.     (set #VDSKNUM 1)
  34.  
  35.     (until (= 1 #VSAVEDONE)(
  36.         (set #VDSKNUMR (+ 1 #VDSKNUM))
  37.         (working "Examining save disk " #VDSKNUM)
  38.  
  39.         ; determine status of this disk - missing, blank or used
  40.         (set #VT1 (tackon #VDATDIR (cat "Disk." #VDSKNUMR)))
  41.         (set #VSTS 0)
  42.         (if (= 1 (exists #VT1))(
  43.             (set #VT2 (getsum #VT1))
  44.             (if (= 16257030 #VT2)(
  45.                 ; blank
  46.                 (set #VSTS 1)
  47.             )(
  48.                 ; changed, assume something saved on it
  49.                 (set #VSTS 2)
  50.             ))
  51.         ))
  52.  
  53.         ; set prompt and options for this disk
  54.         (set #VPMT (cat "Save disk " #VDSKNUM " "))
  55.  
  56.         (if (= 0 #VSTS)(
  57.             (set #VOVR 0)
  58.             (set #VPMT (cat #VPMT "does not exist"))
  59.             (set #VCH0 "Install blank save disk")
  60.             (set #VCH1 "Install existing save disk")
  61.             (set #VCH2 "")
  62.             (set #VDEF 3)
  63.         ))
  64.  
  65.         (if (= 1 #VSTS)(
  66.             (set #VOVR 0)
  67.             (set #VPMT (cat #VPMT "exists and is blank"))
  68.             (set #VCH0 "")
  69.             (set #VCH1 "Overwrite with existing save disk")
  70.             (set #VCH2 "Skip this disk")
  71.             (set #VDEF 2)
  72.         ))
  73.  
  74.  
  75.         (if (= 2 #VSTS)(
  76.             (set #VOVR 1)
  77.             (set #VPMT (cat #VPMT "exists and contains data"))
  78.             (set #VCH0 "Overwrite with blank save disk")
  79.             (set #VCH1 "Overwrite with existing save disk")
  80.             (set #VCH2 "Skip this disk")
  81.             (set #VDEF 2)
  82.         ))
  83.  
  84.         (set #VCH3 "Finish installation")
  85.         (set #VPMT (cat #VPMT ".\nWhat do you want to do?"))
  86.  
  87.         (set #VCH
  88.             (askchoice
  89.                 (prompt #VPMT)
  90.                 (choices #VCH0 #VCH1 #VCH2 #VCH3)
  91.                 (default #VDEF)
  92.                 (help @askchoice-help)
  93.             )
  94.         )
  95.  
  96.         ; if user is overwriting a used disk, confirm it
  97.         (if (AND (= 1 #VOVR)
  98.                  (OR (= 0 #VCH) (= 1 #VCH)))(
  99.             (if (= 0 (askbool
  100.                         (prompt "\n\nTHIS WILL ERASE ALL DATA ON THE SAVE DISK!\n\nProceed?")
  101.                         (default 0)
  102.                         (help @askbool-help)
  103.                      ))(
  104.                 (debug "choice no overwrite")
  105.                 (set #VCH 2)
  106.             ))
  107.         ))
  108.  
  109.         ; do stuff depending on choice
  110.         (set #VT2 -1)
  111.         (set @execute-dir #VDATDIR)
  112.  
  113.         (if (= 0 #VCH)(
  114.             (working (cat "Creating blank save disk"))
  115.             (set #VT2 (run (cat "TOBMakeSave " #VDSKNUMR)))
  116.         ))
  117.  
  118.         (if (= 1 #VCH)(
  119.             (message "Please insert save disk into drive DF0:")
  120.             (working (cat "Creating blank save disk"))
  121.             (set #VT2 (run (cat "DIC NAME=Disk." #VDSKNUMR " FD=" #VDSKNUMR " LD=" #VDSKNUMR)))
  122.         ))
  123.  
  124.         (if (= 3 #VCH)(
  125.             (set #VSAVEDONE 1)
  126.         ))
  127.  
  128.         ; handle errors
  129.         (set @execute-dir #VOLDEXEDIR)
  130.  
  131.         (if (<> -1 #VT2)(
  132.             (if (= 0 #VT2)(
  133.                 (message "\n\nSave disk created!")
  134.             )(
  135.                 (abort  "\n\nProblem creating save disk!"
  136.                          "\nError code: " #VT2
  137.                          "\n\nPlease contact the author for further information."
  138.                 )
  139.             ))
  140.         ))
  141.  
  142.         ; move to next disk
  143.         (set #VDSKNUM (+ 1 #VDSKNUM))
  144.         (if (> #VDSKNUM 9) (set #VSAVEDONE 1))
  145.     ))
  146. ))
  147.  
  148.  
  149. ;================================================================================
  150. ;
  151. (welcome (cat "Welcome to the Tower of Babel Save Disk Installer"))
  152. ;
  153.  
  154. ;
  155. ; Initialise
  156. ;
  157. (set @app-name #CFG_APPNAME)
  158. (set #VOLDEXEDIR @execute-dir)
  159. (set #VDESTDIR @default-dest)
  160. (set #VDATDIR (tackon #VDESTDIR "data/"))
  161.  
  162. ;
  163. ; Check settings
  164. ;
  165. (if    (<> @user-level 2)
  166.     (abort "You must select 'Expert' user level")
  167. )
  168.  
  169. (if    (< @installer-version 2818051)
  170.     (abort "This product requires at least version 43.3 of the Installer program")
  171. )
  172.  
  173. ;
  174. ; Check required programs are available
  175. ;
  176. (set #VP1 "DIC")
  177. (P_CheckRun)
  178.  
  179. ;
  180. ; Welcome message
  181. ;
  182. (message "\n\nWelcome to the Tower of Babel Save Disk Installer"
  183.          "\n© " #CFG_APPCOPY " John Girvin/Halibut Software\n\n"
  184.          "Please read the documentation thoroughly "
  185.          "before attempting to use this installer!\n\n"
  186.          "This is release " #CFG_APPVER "\n\n"
  187.          "Click 'Proceed' to begin..."
  188. )
  189.  
  190. ;
  191. ; Get directory to install in
  192. ;
  193. (while (<> 2 (exists #VDATDIR))(
  194.     (set #VDESTDIR
  195.         (askdir
  196.             (prompt "Where do you have Tower of Babel installed?\n")
  197.             (help @askdir-help)
  198.             (default @default-dest)
  199.             (disk)
  200.             (newpath)
  201.         )
  202.     )
  203.     (set #VDESTDIR (expandpath #VDESTDIR))
  204.     (set @default-dest #VDESTDIR)
  205.     (set #VDATDIR  (tackon #VDESTDIR "data/"))
  206. ))
  207.  
  208. ;
  209. ; Install the save disks
  210. ;
  211. (P_InstallGame)
  212.  
  213. ;=================================================================================================
  214. ;$VER: Tower of Babel Save Disk Installer script R0401.1 © 1997-2001 John Girvin/Halibut Software